import { makeRequiredRule } from '../../../utils'

const label = '数字'
const name = 'inputNumber'
let i = 1
const uniqueId = () => `${name}${i++}`
export default {
  label,
  name,
  rule() {
    return {
      type: name,
      field: uniqueId(),
      title: label,
      props: {}
    }
  },
  props() {
    return [
      makeRequiredRule(),
      { type: 'inputNumber', field: 'min', title: '设置计数器允许的最小值' },
      {
        type: 'inputNumber',
        field: 'max',
        title: '设置计数器允许的最大值'
      },
      {
        type: 'switch',
        field: 'controls',
        title: '是否使用控制按钮',
        value: true
      },
      { type: 'input', field: 'placeholder', title: '提示文字' }
    ]
  }
}
